package bb.lanxing.model.database;

//import com.easemob.chat.core.e;
//import com.orm.SugarRecord;
//import com.orm.dsl.Table;
//import com.orm.query.Select;

import org.json.JSONObject;
import org.litepal.LitePal;

import bb.lanxing.util.DateUtil;
import bb.lanxing.util.JsonUtil;

public class UserCard extends LitePalTableBase {
    public static final int CARD_TYPE_IDENTITY = 0;
    public static final int CARD_TYPE_OTHER = 2;
    public static final int CARD_TYPE_PASSPORT = 1;
    public static final int GENDER_FEMALE = 2;
    public static final int GENDER_MALE = 1;
    private String address;
    private String addressDetail;
    private String area;
    private long birthday;
    private long cardId;
    private String cardNo;
    private int cardType;
    private String city;
    private String contactName;
    private String contactPhone;
    private String email;
    private int gender;
    private String name;
    private String phone;
    private String province;
    private long userId;

    public UserCard() {
    }

    public UserCard(JSONObject jSONObject) {
        this.userId = JsonUtil.getLongValue("userId", jSONObject);
        this.cardId = JsonUtil.getLongValue("cardId", jSONObject);
        this.name = JsonUtil.getStringValue("name", jSONObject);
        this.cardNo = JsonUtil.getStringValue("cardNo", jSONObject);
        this.gender = JsonUtil.getIntegerValue("gender", jSONObject);
        this.birthday = JsonUtil.getLongValue("birthday", jSONObject);
        this.email = JsonUtil.getStringValue("email", jSONObject);
        this.phone = JsonUtil.getStringValue("phone", jSONObject);
        this.address = JsonUtil.getStringValue("address", jSONObject);
        this.contactName = JsonUtil.getStringValue("contactName", jSONObject);
        this.contactPhone = JsonUtil.getStringValue("contactPhone", jSONObject);
        this.province = JsonUtil.getStringValue("province", jSONObject);
        this.city = JsonUtil.getStringValue("city", jSONObject);
        this.area = JsonUtil.getStringValue("area", jSONObject);
        this.addressDetail = JsonUtil.getStringValue("addressDetail", jSONObject);
    }

    public static UserCard getUserCard(long j) {

        String userId = String.valueOf(j);

        UserCard u = LitePal.where("userId = ?", userId).findFirst(UserCard.class);
        return u;

//        return (UserCard) Select.from(UserCard.class).where("user_id = ?", new String[]{String.valueOf(j)}).first();
    }

    public void setUserId(long j) {
        this.userId = j;
    }

    public long getUserId() {
        return this.userId;
    }

    public void setCardId(long j) {
        this.cardId = j;
    }

    public long getCardId() {
        return this.cardId;
    }

    public void setName(String str) {
        this.name = str;
    }

    public String getName() {
        return this.name;
    }

    public void setCardType(int i) {
        this.cardType = i;
    }

    public int getCardType() {
        return this.cardType;
    }

    public void setCardNo(String str) {
        this.cardNo = str;
    }

    public String getCardNo() {
        return this.cardNo;
    }

    public void setGender(int i) {
        this.gender = i;
    }

    public int getGender() {
        return this.gender;
    }

    public String getGenderFormat() {
        int i = this.gender;
        return i != 1 ? i != 2 ? "" : "女" : "男";
    }

    public void setBirthday(long j) {
        this.birthday = j;
    }

    public long getBirthday() {
        return this.birthday;
    }

    public String getBirthdayFormat() {
        long j = this.birthday;
        return j == 0 ? "" : DateUtil.format(j * 1000, 1);
    }

    public void setEmail(String str) {
        this.email = str;
    }

    public String getEmail() {
        return this.email;
    }

    public void setPhone(String str) {
        this.phone = str;
    }

    public String getPhone() {
        return this.phone;
    }

    public void setAddress(String str) {
        this.address = str;
    }

    public String getAddress() {
        return this.address;
    }

    public void setContactName(String str) {
        this.contactName = str;
    }

    public String getContactName() {
        return this.contactName;
    }

    public void setContactPhone(String str) {
        this.contactPhone = str;
    }

    public String getContactPhone() {
        return this.contactPhone;
    }

    public String getProvince() {
        return this.province;
    }

    public void setProvince(String str) {
        this.province = str;
    }

    public String getCity() {
        return this.city;
    }

    public void setCity(String str) {
        this.city = str;
    }

    public String getArea() {
        return this.area;
    }

    public void setArea(String str) {
        this.area = str;
    }

    public String getAddressDetail() {
        return this.addressDetail;
    }

    public void setAddressDetail(String str) {
        this.addressDetail = str;
    }
}
